﻿@model Cafeteria.Models.Compra.Ordencompra.OrdenProducto

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript" src="/Scripts/ValidacionOrdenDeCompra.js"></script>


 @using (Html.BeginForm("Registrar2", "OrdenCompra", FormMethod.Post, new { @class = "form" }))
 {   
    <fieldset>
        <div class="widget">
            <div class="title">
                <h6>Generar Orden Compra</h6>
                @Html.HiddenFor(model => model.idproveedor) 
                
            </div>
            <div class="formRow"> @Html.LabelFor(model => model.proveedor)
                <div class=" formRight">  @Html.DisplayFor(model => model.proveedor)  </div>
                <div class="clear"></div>
            </div>
            <div class="formRow"> @Html.LabelFor(model => model.nombrecafeteria) @Html.HiddenFor(model => model.idcafeteria) 
                <div class=" formRight">  @Html.DisplayFor(model => model.nombrecafeteria)  </div>
                <div class="clear"></div>
            </div>
            
        </div>
    </fieldset>
     
    for (int i = 0; (i < Model.listaProducto.Count); i++)
    {
      @Html.HiddenFor(model => model.listaProducto[i].idproducto) @Html.HiddenFor(model => model.listaProducto[i].Nombre)
    }
    
     
   <div class="wrapper">
    <div class="widget">
      <div class="title">
      <h6>Lista de Ingredientes que tiene el Proveedor</h6>
      </div>
     <div class="dataTables_wrapper">
            
            <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable">
    <thead>
        <tr>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:150px;" >
                <div class="DataTables_sort_wrapper">
                Producto
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
             <th class="ui-state-default" rowspan="1" colspan="1" style="width:100px;" >
                <div class="DataTables_sort_wrapper">
                Precio
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:100px;" >
                <div class="DataTables_sort_wrapper">
                Stock Actual
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
             <th class="ui-state-default" rowspan="1" colspan="1" style="width:100px;" >
                <div class="DataTables_sort_wrapper">
                Stock Minimo
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:100px;" >
                <div class="DataTables_sort_wrapper">
                Stock Maximo
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
             <th class="ui-state-default" rowspan="1" colspan="1" style="width:100px;" >
                <div class="DataTables_sort_wrapper">
                Stock Cantidad
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>

        </tr>
    </thead>

    <tbody>
                @for (int i = 0; (i < Model.listaProducto.Count); i++)
                {
            @Html.HiddenFor(model => model.listaProducto[i].idproducto) @Html.HiddenFor(model => model.listaProducto[i].Nombre)
                <tr class="gradeA odd">       
                
                        <td> @Html.DisplayFor(model => model.listaProducto[i].Nombre) </td>
                        <td> @Html.DisplayFor(model => model.listaProducto[i].precio) </td>
                        <td> @Html.DisplayFor(model => model.listaProducto[i].stockActual)   </td>
                        <td> @Html.DisplayFor(model => model.listaProducto[i].stockMinimo)   </td>
                        <td> @Html.DisplayFor(model => model.listaProducto[i].stockMaximo)   </td>
                        <td> 
                            @Html.TextBoxFor(model => model.listaProducto[i].cantidad, new { maxlength = "3", placeholder = "Solo números" })
                            @Html.ValidationMessageFor(model => model.listaProducto[i].cantidad)
                        </td>
                </tr>


                }
    </tbody>
    </table>
    </div> 
   </div>
</div>
     
     
     
    <p></p><p></p>
    <p>        
       @if (Model.estado2)
       {       
            <input type="submit" value="Crear" class = "redB" />
       }
       | <a href="javascript:window.history.back();">Regresar</a>
    </p>
    
 }